test: integrate riscv64im-unknown-openvm-elf target into build system#2765
test: integrate riscv64im-unknown-openvm-elf target into build system#2765Tuanlinh12312 wants to merge 1 commit intodevelop-v2.1.0-rv64from
Conversation
|
Claude finished @Tuanlinh12312's task in 3m 40s —— View job Code Review: PR #2765 — Integrate
|
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
can you use the develop v2 rc1 implementation for this and adapt to rv64. it's better if the diff is minimal and only contains the necessary changes and any fixes
https://github.com/openvm-org/openvm/blob/69373ff1d06b613025fe4e7a02d735a1609412c4/crates/toolchain/openvm/src/pal_abi.rs
Update the OpenVM build system and guest crates to support the new built-in Rust target `riscv64im-unknown-openvm-elf` (target_os = "openvm"). Changes: - Switch RUSTC_TARGET from JSON spec to built-in target - Add pal_abi.rs bridging std PAL extern symbols to OpenVM custom instructions - Fix entry! macro to work with std + openvm_intrinsics - Add target_os = "openvm" to platform Cargo.toml dependency cfg gate - Add std to build-std when std feature is requested - Skip rustup component checks for linked toolchains - Update no_main cfg gate across all guest programs Tested: 18/19 riscv integration tests pass (including std tests). One failure (test_tiny_mem_test) is an upstream embedded-alloc crate incompatibility with newer Rust nightly. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
aafca0a to
e8e2e8f
Compare
|
Claude finished @Tuanlinh12312's task in 3m 31s —— View job Code Review: PR #2765 — Integrate
|
Note: cells_used metrics omitted because CUDA tracegen does not expose unpadded trace heights. Commit: e8e2e8f |
Summary
Integrate the new built-in Rust target
riscv64im-unknown-openvm-elf(target_os = "openvm") into the OpenVM build system and guest crates. This replaces the custom JSON target spec (riscv64im-openvm-none-elf,target_os = "none") and enablesstdsupport for guest programs.The target itself was added to the OpenVM Rust fork in openvm-org/rust#3.
Changes
Build system (
crates/toolchain/build/src/lib.rs):RUSTC_TARGETfromriscv64im-openvm-none-elftoriscv64im-unknown-openvm-elfopenvm-rv64(custom-built rustc from the fork)stdto-Zbuild-stdcrate list whenstdfeature is requestedrustup componentchecks for linked (non-rustup-managed) toolchainsGuest runtime (
crates/toolchain/openvm/):pal_abi.rs: providessys_write,sys_panic,sys_rand,sys_halt,sys_alloc_words, and otherextern "C"symbols that thestdPAL declares. Bridges them to OpenVM's custom RISC-V instructions viaopenvm_riscv_guest.entry!macro to generate#[no_mangle] fn main()when bothstdandopenvm_intrinsicsare active (previously only generated it forno_std).Platform (
crates/toolchain/platform/Cargo.toml):target_os = "none"toany(target_os = "none", target_os = "openvm")solibmresolves for the new target.Guest programs (~100 files):
no_maincfg gate fromcfg_attr(target_os = "none", no_main)tocfg_attr(any(target_os = "none", target_os = "openvm"), no_main)across all guest programs.Test plan
Local test setup
Tests require a custom
rustctoolchain built from the fork branchfeat/riscv64im-unknown-openvm-elf(openvm-org/rust#3):Test results
cargo nextest run --cargo-profile=fast -p openvm-riscv-integration-tests --run-ignored all18/19 pass.
test_tiny_mem_testfails becauseembedded-alloc0.6.0 callsLayout::dangling()which was renamed toLayout::dangling_ptr()in the newer Rust nightly our fork is built from. This is an upstream crate incompatibility — latestembedded-alloc(0.7.0) has the same issue.CI note
CI does not have the custom
openvm-rv64toolchain. A toolchain distribution workflow (building and releasing customrustcbinaries, similar to zisk and sp1) is needed as follow-up work.🤖 Generated with Claude Code